package com.atguigu.lease.common.ssms;


import com.aliyun.credentials.exception.CredentialException;
import com.aliyun.dysmsapi20170525.Client;
import com.aliyun.teaopenapi.models.Config;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

import java.io.IOException;
import java.text.ParseException;

/**
 * @ClassName SSMSClient
 * @Author heartFade
 * @Date 2025-05-04 23:10
 * @Version 1.0
 * @Description TODO
 **/
@Configuration
@EnableConfigurationProperties(SSMSClientProperties.class)
public class SSMSClient {
    @Autowired
    SSMSClientProperties ssmsClientProperties;
    @Bean
    public Client getClient() throws Exception {

      Config config = new Config()
              .setAccessKeyId(ssmsClientProperties.getAccessKeyId()).setEndpoint(ssmsClientProperties.getEndPoint())
              .setAccessKeySecret(ssmsClientProperties.getAccessKeySecret());


        return new Client(config);
    }
}
